#Compile ES1 for Linux
#using gcc

CC = gcc
HOMEDIR = /home/oddi/Code/es1
OUTDIR = $(HOMEDIR)/out
WINTARGET = $(OUTDIR)/es1

WINDOWSSWITCH =
OMP=

INCLUDE = -I$(HOMEDIR) \
	-I/usr/include
SRCDIR=$(HOMEDIR)/src/core
LIBS =  -lgsl \
	-lgslcblas \
	-lm 
STATIC = -static
CFLAGS = -DDEBUG \
        -DVERBOSE \
  	-D__LINUX__ \
         $(INCLUDE)

LFLAGS = -L/usr/lib \
	$(LIBS) \
	$(OMP)



OBJS =  $(OUTDIR)/main.o \
	$(OUTDIR)/ucgrid1d.o \
	$(OUTDIR)/task1d.o \
	$(OUTDIR)/mover1d.o \
	$(OUTDIR)/ebsources.o \
	$(OUTDIR)/lib.o \
	$(OUTDIR)/poisson1d.o \
	$(OUTDIR)/particles.o

$(OUTDIR)/main.o : 
	$(CC) $(CFLAGS) -c -o $(OUTDIR)/main.o $(HOMEDIR)/main.c 

$(OUTDIR)/ucgrid1d.o : 
	$(CC) $(CFLAGS) -c -o $(OUTDIR)/ucgrid1d.o $(SRCDIR)/ucgrid1d.c 

$(OUTDIR)/task1d.o : 
	$(CC) $(CFLAGS)  -c -o $(OUTDIR)/task1d.o $(SRCDIR)/task1d.c 

$(OUTDIR)/mover1d.o : 
	$(CC) $(CFLAGS) -c -o $(OUTDIR)/mover1d.o $(SRCDIR)/mover1d.c 

$(OUTDIR)/ebsources.o : 
	$(CC) $(CFLAGS) -c -o $(OUTDIR)/ebsources.o $(SRCDIR)/ebsources.c 

$(OUTDIR)/lib.o : 
	$(CC) $(CFLAGS) $(INCLUDE) -c -o $(OUTDIR)/lib.o $(SRCDIR)/lib.c 

$(OUTDIR)/poisson1d.o : 
	$(CC) $(CFLAGS)  -c -o $(OUTDIR)/poisson1d.o $(SRCDIR)/poisson1d.c 

$(OUTDIR)/particles.o : 
	$(CC) $(CFLAGS)  -c -o $(OUTDIR)/particles.o $(SRCDIR)/particles.c 

main : $(OBJS)
	$(CC) $(CFLAGS)  $(OBJS) -o $(WINTARGET) $(LFLAGS) $(STATIC) $(WINDOWSSWITCH)
clean :
	rm -rf $(OBJS)
	rm -rf $(WINTARGET)





